fontchooser: Store the font description in the model
authorBenjamin Otte <otte@redhat.com>
Mon, 19 Sep 2011 15:58:51 +0000 (17:58 +0200)
committerBenjamin Otte <otte@redhat.com>
Mon, 19 Sep 2011 20:11:06 +0000 (22:11 +0200)
It's actually expensive to create (>5ms per font with >1000 fonts
installed), so better cache it.

gtk/gtkfontchooserwidget.c

index 1bd14055c1894fbc465a95ac8cb12a3ab70412df..e1cf90a19b14f19b1e0c9d0b7f233765709275a9 100644 (file)
@@ -126,6 +126,7 @@ static const gint font_sizes[] = {
 enum {
   FAMILY_COLUMN,
   FACE_COLUMN,
+  FONT_DESC_COLUMN,
   PREVIEW_TEXT_COLUMN,
   PREVIEW_TITLE_COLUMN
 };
@@ -765,6 +766,7 @@ populate_list (GtkFontChooserWidget *fontchooser,
           gtk_list_store_insert_with_values (model, &iter, -1,
                                              FAMILY_COLUMN, families[i],
                                              FACE_COLUMN, faces[j],
+                                             FONT_DESC_COLUMN, pango_desc,
                                              PREVIEW_TITLE_COLUMN, family_and_face,
                                              PREVIEW_TEXT_COLUMN, tmp,
                                              -1);
@@ -886,9 +888,10 @@ gtk_font_chooser_widget_bootstrap_fontlist (GtkFontChooserWidget *fontchooser)
   GtkCellRenderer   *cell;
   GtkTreeViewColumn *col;
 
-  priv->model = gtk_list_store_new (4,
+  priv->model = gtk_list_store_new (5,
                                     PANGO_TYPE_FONT_FAMILY,
                                     PANGO_TYPE_FONT_FACE,
+                                    PANGO_TYPE_FONT_DESCRIPTION,
                                     G_TYPE_STRING,
                                     G_TYPE_STRING);